<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>搜索结果</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
            text-align: center;
        }
        .query-box {
            margin: 20px 0;
            padding: 15px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background-color: #f9f9f9;
        }
        .result-box {
            margin: 20px 0;
            padding: 15px;
            border: 1px solid #4CAF50;
            border-radius: 4px;
            background-color: #e8f5e9;
        }
        .question-item {
            margin: 10px 0;
            padding: 10px;
            background-color: white;
            border-radius: 4px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        .similarity {
            color: #2196F3;
            font-weight: bold;
        }
        .back-button {
            background-color: #2196F3;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            display: block;
            margin: 20px auto;
            text-decoration: none;
            text-align: center;
        }
        .back-button:hover {
            background-color: #1976D2;
        }
        .ai-result {
            white-space: pre-wrap;
            line-height: 1.5;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>搜索结果</h1>
        <div class="query-box">
            <h3>搜索内容：</h3>
            <p th:text="${query}"></p>
        </div>
        <div class="result-box">
            <h3>相似题目：</h3>
            <div th:if="${similarQuestions.empty}">
                <p>未找到相似题目</p>
            </div>
            <div th:each="question : ${similarQuestions}" class="question-item">
                <p><strong>问题：</strong><span th:text="${question.question}"></span></p>
                <p><strong>答案：</strong><span th:text="${question.answer}"></span></p>
                <p><strong>相似度：</strong><span class="similarity" th:text="${#numbers.formatDecimal(question.similarity, 1, 4)}"></span></p>
            </div>
        </div>
        <div class="result-box">
            <h3>教师整理结果：</h3>
            <div class="ai-result" th:text="${processedResult}"></div>
        </div>
        <a href="/question" class="back-button">返回搜索</a>
    </div>
</body>
</html> 